﻿using System;
using System.Xml.Linq;

namespace Holidays.CountryCalculators {

	public class EnglishCalculator : BaseCalculator {

		public override Boolean IsWeekend(DateTime date) {
			return date.DayOfWeek == DayOfWeek.Saturday || date.DayOfWeek == DayOfWeek.Sunday;
		}

		protected override Boolean IsDynamicHoliday(DateTime date, XDocument holidayData) {
			DateTime easter = date.Easter(EasterAlgorithm.Gauss);
			// TODO: Dynamic, based on en-UK.xml!??!
			return (
					// Good Friday
					easter.AddDays(-2).Date == date.Date ||
					// Easter Monday
					easter.AddDays(1).Date == date.Date ||
					// Easter
					easter.Date == date.Date ||
					date.FirstInMonth(DayOfWeek.Monday).Date == date.Date ||
					date.LastInMonth(DayOfWeek.Monday).Date == date.Date
				);
		}
	}
}